home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_100 / 122_01 / pistol.h < prev    next >
Text File  |  1984-03-05  |  5KB  |  232 lines

  1. /*********************************************************/
  2. /*                             */
  3. /* PISTOL-Portably Implemented Stack Oriented Language     */
  4. /*            Version 2.0             */
  5. /* (C) 1983 by    Ernest E. Bergmann             */
  6. /*        Physics, Building #16             */
  7. /*        Lehigh Univerisity             */
  8. /*        Bethlehem, Pa. 18015             */
  9. /*                             */
  10. /* Permission is hereby granted for all reproduction and */
  11. /* distribution of this material provided this notice is */
  12. /* included.                         */
  13. /*                             */
  14. /*********************************************************/
  15. /* for PISTOL v2.0 in BDS 'C' v1.45a */
  16. /* September 5, 1982 */
  17.  
  18. #define    W        2
  19. #define VERSION        20
  20. #define    RAMSIZE        5000
  21. #define RAMMIN        -21    /* most negative constant */
  22. #define COMPBUF        RAMSIZE-W*200
  23. #define NSAVE        124    /* used by coredump&restore */
  24. #define STRINGSSIZE    NSAVE*128-W*RAMSIZE+W*RAMMIN
  25. #define LINEBUF        3300
  26. #define NFUNCS        73
  27.  
  28. #define    SSIZE        200
  29. #define LSIZE        30
  30. #define CSIZE        30
  31. #define    RSIZE        30
  32. #define    VBASE        41
  33. #define VSIZE        8
  34. #define CHKLMT        20
  35. #define MAXORD        128
  36. #define    MAXINT        32767
  37. #define MININT        -32768
  38. #define MAXLINNO    300
  39. #define NAMESIZE    20
  40.  
  41. #define    FALS        0
  42. #define TRU        -1
  43. #define NEWLINE        10    /* for 'C' */
  44. #define RPROTECT    TRU
  45. #define WPROTECT    TRU
  46.  
  47. #define TERMWIDTH    64
  48. #define TERMLENGTH    20
  49.  
  50. #define PSEMICOLON    0
  51. #define WSTORE        1
  52. #define TIMES        2
  53. #define    PLUS        3
  54. #define    SUBTRACT    4
  55. #define    DIVMOD        5
  56. #define PIF        6
  57. #define WAT        7
  58. #define ABRT        8
  59. #define SP        9
  60. #define LOAD        10
  61. #define    PELSE        11
  62. #define WRD        12
  63. #define RP        13
  64. #define DROPOP        14
  65. #define PUSER        15
  66. #define EXEC        16
  67. #define EXITOP        17
  68. #define LIT        18
  69. #define STRLIT        19
  70. #define RPOP        20
  71. #define SWP        21
  72. #define TYI        22
  73. #define TYO        23
  74. #define RPSH        24
  75. #define SEMICF        25
  76. #define RAT        26
  77. #define COMPME        27
  78. #define COMPHERE    28
  79. #define DOLLARC        29
  80. #define COLON        30
  81. #define SEMICOLON    31
  82. #define IFOP        32
  83. #define ELSEOP        33
  84. #define THENOP        34
  85. #define DOOP        35
  86. #define LOOPOP        36
  87. #define BEGINOP        37
  88. #define ENDOP        38
  89. #define REPET        39
  90. #define PERCENT        40
  91. #define PDOLLAR        41
  92. #define PCOLON        42
  93. #define CASAT        43
  94. #define PDOOP        44
  95. #define PPLOOP        45
  96. #define PLLOOP        46
  97. #define CAT        47
  98. #define CSTORE        48
  99. #define PLOOP        49
  100. #define DOTDOT        50
  101. #define SEMIDOL        51
  102. #define PRMQ        52
  103. #define CORDMP        53
  104. #define RESTOR        54
  105. #define SAT        55
  106. #define FINDOP        56
  107. #define LISTFIL        57
  108. #define VFINDOP        58
  109. #define LAT        59
  110. #define OFCAS        60
  111. #define CCOLON        61
  112. #define SEMICC        62
  113. #define NDCAS        63
  114. #define POFCAS        64
  115. #define PCCOL        65
  116. #define PSEMICC        66
  117. #define GTLIN        67
  118. #define WORD        68
  119. #define OPENR        69
  120. #define OPENW        70
  121. #define READL        71
  122. #define WRITL        72
  123.  
  124. char ldfil[BUFSIZ],list[BUFSIZ]; /* will overlay init() */
  125.  
  126. union word
  127.     {int in;
  128.     char cr;
  129.     unsigned un;
  130.     char *pc;
  131.     union word *pw;
  132.     };
  133.  
  134. char jbuf[JBUFSIZE]; /* to use in setjmp(),longjump() */
  135.  
  136. unsigned ip;    /* but can be used for machine addresses */
  137. unsigned instr;
  138. int    temp;
  139. int    savlevel,savinstr;    /*for trace in interpret();*/
  140.  
  141. int    stkptr;
  142. int    rptr;
  143. int    lptr;
  144. int    cptr;
  145.  
  146. int    *Pw,*Pw2;    /* needed for pointer conversions */
  147. char    *Pc,*Pc2;    /* needed for pointer conversions */
  148.  
  149. int    (*farray[NFUNCS])(); /* to hold pointers to interpreted
  150.                 primitive functions */
  151. int    mstack[3];    /* extra padding */
  152. int    stack[SSIZE];
  153. int    pstack[3];    /* extra padding */
  154. int    lstack[LSIZE];
  155. int    rstack[RSIZE];
  156. int    cstack[CSIZE];
  157.  
  158. char    imagename[NAMESIZE];
  159. char    namein[NAMESIZE];
  160. char    namout[NAMESIZE];
  161. char    infil[NAMESIZE];
  162. char    listname[NAMESIZE];
  163. char    c;/*??? assignable to eof()?*/
  164. char    nullname;
  165.  
  166. char    *feof;
  167. char    *nopen;
  168. char    *id;
  169. char    *synt;
  170. char    *ovflo;
  171. char    *undflo;
  172. char    *redef;
  173. char    *divby0;
  174. char    *readv;
  175. char    *writv;
  176.  
  177. int    addr;
  178. int    val;
  179. int    i,j;
  180.  
  181. union word nram[-RAMMIN]; /* space for negative args for ram */
  182. union word ram[RAMSIZE];
  183. char    strings[STRINGSSIZE];
  184.  
  185. char edin[BUFSIZ],edout[BUFSIZ];/*for editor file i/o buffs */
  186. /*"static variables" for vfind,pstrcmp*/
  187. int *ptoken;
  188. int *vloc;
  189. char vmatch;
  190. char pcount,*Pc3;
  191. int *prev;
  192.  
  193. /* "static" for ttyi() */
  194. char keycurs,keylen,keystring[MAXORD];
  195.  
  196. /* "static" for pdo() */
  197. int start,nd;
  198.  
  199. /* "static" for move() */
  200. char *as,*ad,*endaddr;
  201. int nowd;
  202.  
  203. /* "static" for swap() */
  204. int hold;
  205.  
  206. /* "static" for many interpreter functions */
  207. int tos,ntt,param;
  208.  
  209. /* "static" for compline() */
  210. int inf,*pad;
  211.  
  212. /* "static" for slit() and longstring() */
  213. char ic, *sstart;
  214.  
  215. /* "static" for intoken() */
  216. char count, *ptr2;
  217.  
  218. /* "static" for convert() */
  219. char *tend;
  220.  
  221. /* "static" for touchup() */
  222. int ref;
  223. ar    nullname;
  224.  
  225. char    *feof;
  226. char    *nopen;
  227. char    *id;
  228. char    *synt;
  229. char    *ovflo;
  230. char    *undflo;
  231. char    *redef;
  232. char    *divby